﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DataList的使用._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        
        <style type="text/css">
        	td
        	{
        		border: 1px solid #ccc;
        	}
        </style>
        
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
    
                <asp:DataList ID="DataList1" runat="server"  Width="700px" 
                              RepeatDirection="Horizontal" RepeatColumns="3">
                    <ItemTemplate>
                        <table style="width: 400px; margin: 20px; padding: 10px;">
                            <tr><td>学号：</td><td>
                                                <asp:label runat="server" ID="lblStudentID" Text='<%#Eval("StudentID")%>' 
                                                    ></asp:label></td><td rowspan="3">
                                                                          <asp:image runat="server" ID="imgStudent" 
                                                                                     ImageUrl='<%#"images/" + Eval("Photo")%>'   /></td></tr>
                            <tr><td>姓名：</td><td><asp:label runat="server" ID="lblStudentName" Text='<%#Eval("Name")%>'></asp:label></td></tr>
                            <tr><td>系：</td><td><asp:label runat="server" ID="lblDepartment" Text='<%#Eval("DepartmentName")%>'></asp:label></td></table>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <table style="width: 400px; margin: 20px; padding: 10px; background-color: #ccc">
                            <tr><td>学号：</td><td>
                                                <asp:label runat="server" ID="lblStudentID" Text='<%#Eval("StudentID")%>' 
                                                    ></asp:label></td><td rowspan="3">
                                                                          <asp:image runat="server" ID="imgStudent" 
                                                                                     ImageUrl='<%#"images/" + Eval("Photo")%>'   /></td></tr>
                            <tr><td>姓名：</td><td><asp:label runat="server" ID="lblStudentName" Text='<%#Eval("Name")%>'></asp:label></td></tr>
                            <tr><td>系：</td><td><asp:label runat="server" ID="lblDepartment" Text='<%#Eval("DepartmentName")%>'></asp:label></td></table>
                    </AlternatingItemTemplate>
                </asp:DataList>
    
            </div>
        </form>
    </body>
</html>